package ioc

import (
	"github.com/spf13/viper"
	"google.golang.org/grpc"
	grpc2 "jk-time/webook/payment/grpc"
	"jk-time/webook/pkg/grpcx"
)

func NewGrpcxServer(intrSrv *grpc2.WechatServiceServer) *grpcx.Server {
	server := grpc.NewServer()
	intrSrv.Register(server)
	port := viper.GetInt("grpc.server.payment.port")
	name := viper.GetString("grpc.server.payment.name")
	etcdAddr := viper.GetString("etcd.addr")

	return &grpcx.Server{
		Server:   server,
		Port:     port,
		EtcdAddr: etcdAddr,
		Name:     name,
	}
}
